/**
 * Created by liujz on 3/6/17.
 */
const Person = require('./person').Person;

class Teacher extends Person{
    constructor(name,age,klasses){
        super(name,age);
        this.klasses = klasses;
    }

    introduce() {
        return super.introduce() + ' I am a Teacher. I teach ' + (this.klasses.length!=0 ? 'Class ' + this.klasses.map(k=>k.num).join(',') : 'no Class') + '.';
    }

    isTeaching(student){
        for(let klass of this.klasses){
            if(klass.isIn(student)){
                return true;
            }
        }
        return false;
    }
}

module.exports.Teacher = Teacher;